
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>

    <meta charset="UTF-8">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../../lib/laydate.css"/>
    <script type="text/javascript" src="../../js/news/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="../../js/ajaxfileupload.js"></script>
    <script src="../../lib/laydate/laydate.js"></script>
    <script src="../../lib/layer/layer.js?20201106"></script>
    <script src="../lib/jquery.form.min.js"></script>

    <title>员工离职信息导入</title>
    <style type="text/css">
        table{
            border-collapse:collapse;
            font-weight: normal;
            width: 50%;
            margin: 0 auto;
            border: #ccc 1px solid;
        }
        table tr td{
            padding: 10px;
        }
        p{
            margin: 0;padding: 0;
        }
        .to{
            text-align: right;
            width:40%;
        }
        .xiazai{
            color: blue;
            cursor: pointer;
        }
        .btn{
            background-color: rgb(43, 127, 224);
            color: #fff;
            border: 0;
            border-radius: 3px;
            cursor:pointer;
        }
        .txt_r{
            text-align: center;
        }
        .p2{
            padding-left:1em;
        }
        select{
            width: 100px;
            height: 28px;
        }
        .export,.export_s{
            width:70px;
            font-size:14px;
            line-height: 30px;
            height:30px;
            border-radius:5px;
            background: #2b7fe0;
            color:#ffffff;
            text-align: center;
            margin-right:30px;
            cursor:pointer;
            margin: 0 auto;
        }

        .tail div {
            font-size: 13px;
        }
    </style>
</head>
<body>

<div class="headPer" style="height: 45px;line-height: 45px;">
    <span style="font-size: 22px"><img src="../img/icon_addrole_06.png" style="margin-right: 12px;vertical-align: middle;margin-left: 30px;">员工离职信息导入</span>
    <%--<a href="/file/payroll/工资模板.xlsx" style="color: #0088cc;font-size: 10pt;margin-left: 20px;">点击下载模板</a>--%>
</div>
<form class="form1" name="form1" id="uploadForm" method="post" action="/hr/leave/leaveImport" enctype="multipart/form-data" >
    <table border="1">

        <tr>
            <td class="txt_r">下载导入模板:</td>
            <td id="" class="p2">
                <input type="hidden" name="time" value="">
                <div class="demand">
                    <a href="/file/hr/离职信息模板.xls" style="color: #0088cc;font-size: 10pt;margin-left: 20px;">员工离职信息导入模板下载</a>
                </div>
            </td>
        </tr>

        <tr>
            <td class="to txt_r" ><fmt:message code="hr.th.SelectImportfile" />：</td>
            <td style=" width:60%;" class="p2">
                <input type="file" name="file" id="wj" value="<fmt:message code="file.th.PleaseSelectFile" />"/>
            </td>
        </tr>
        <tr>
            <td class="to txt_r" >说明：</td>
            <td style=" width:60%;" class="p2 tail" >
                <div>1、请导入.xls文件。</div>
                <div>2、用户名，单位员工(OA中真实姓名)必须填写一个，否则不导入。</div>
                <div>3、离职部门，离职原因，必须填写。拟离职日期不能小于申请日期，否则不导入。</div>
                <div>4、日期的格式应如：2009-10-15。</div>
            </td>
        </tr>
        <tr>
        <tr>
            <td colspan="2"><div class="export">导入</div></td>
        </tr>

    </table>
</form>



<script>

    $(function () {

//        导入
        $('.export').click(function () {
            var dateYear=$('#year option:selected').val();
            var dateMonth=$('#month option:selected').val();
            $('input[name="time"]').val(dateYear +'年'+dateMonth+'月');
            var iframeChild=$("#iframes" , parent.document);
            var iframeUl=$('#iframeUl' , parent.document).find('li');
            $('#uploadForm').ajaxSubmit({
                dataType: 'json',
                data:{
                    type:1
                },
                success:function (res) {
                    if(res.flag){
                        layer.msg('导入成功', {icon: 1});
                    } else {
                        layer.msg('导入失败', {icon: 2});

                    }
                }
            })
        })


        $('.export_s').click(function () {
            var dateYear=$('#year_s option:selected').val();
            var dateMonth=$('#month_s option:selected').val();
            $('.Tims').val(dateYear +'年'+dateMonth+'月');
            var iframeChild=$("#iframes" , parent.document);
            var iframeUl=$('#iframeUl' , parent.document).find('li');
            $('#uploadForm_s').ajaxSubmit({
                dataType: 'json',
                data:{
                    type:2,
                    time:dateYear +'年'+dateMonth+'月'
                },
                success:function (res) {
                    $(iframeUl).eq(1).find('span').addClass('one').end().siblings().find('span').removeClass('one');
                    $(iframeChild).attr('src','/personSalary/personBonus');
                }
            })
        })
    })


    function upfile(){
        var time=$('#year option:selected').val()+'<fmt:message code="chat.th.year" />'+$('#month option:selected').val()+'<fmt:message code="global.lang.month" />';
        var type= $("#type option:selected").val();
        $.ajaxFileUpload({
            url : "/personBonusmsg/personInsert",
            type : 'POST',
            fileElementId : 'wj',
            data:{time:time,type:type},
            contentType:"application/json;charset=UTF-8",
            dataType:'json',
            success: function(data){
                if(data.flag){
                    layer.msg('<fmt:message code="menuSSetting.th.importSuccess" />！',{icon: 1});
                    /*setTimeout(function(){
                     back();
                     }, 2000);*/
                }
                else {
                    layer.msg('<fmt:message code="menuSSetting.th.importFailNoAuth" />！',{icon: 2});
                }
            },

        });

    }

    $("#down").click(function () {
        window.location.href=encodeURI("/file/payroll/模板.xlsx")

    })
    function YYYYMM(){//默认显示查询时间
        var y  = new Date().getFullYear();
        for (var i=(y-10);i<(y+11);i++){
            $('#year').append(new Option(" "+ i ));
            $('#year_s').append(new Option(" "+ i ));
        }
        $('#year').val(y);
        $('#year_s').val(y);

        for (var i=1;i<13;i++){
            $('#month').append(new Option(" " + i ));
            $('#month_s').append(new Option(" " + i ));
        }
        $('#month').val = new Date().getMonth() + 1;
        $('#month_s').val = new Date().getMonth() + 1;
    }YYYYMM();

</script>


</body>
</html>
